package com.xyhy.starter.mfx.repostory;

import com.mybatisflex.core.BaseMapper;
import com.mybatisflex.core.query.QueryTable;
import com.xyhy.core.utils.id.IdUtil;
import com.xyhy.starter.mfx.entity.MfxObject;

import java.util.Objects;

public class MfxObjectRepositoryImpl<T extends MfxObject, TABLE extends QueryTable, MAPPER extends BaseMapper<T>>
        extends MfxRepositoryImpl<T, Long, TABLE, MAPPER> {

  @Override
  protected void fillBeforeInsert(T record) {
    if (Objects.isNull(record.getId())) {
      record.setId(IdUtil.getId());
    }
  }

  @Override
  protected Class<Long> getIdType() {
    return Long.class;
  }
}
